/* eslint-disable */ 
import { App } from '@vue/runtime-core'
import ChuButton from '@/components/form/ChuButton.vue'
import ChuText from '@/components/form/ChuText.vue'
import ChuGroup from '@/components/form/ChuGroup.vue'
import ChuForm from '@/components/form/ChuForm.vue'
import mitt from 'mitt'
import { Router } from 'vue-router'
import { Store } from 'vuex'
import message from '@/static/plugins/message'

declare let window: Window
interface Window{
  chu: ChuProp;
}
interface InstallOptions{
  store: Store<StoreProp>;
  router: Router;
}
const plugin = {
  install: (app: App<Element>,options:InstallOptions) => {
    // 注册公共组件
    app.component(ChuButton.name, ChuButton)
    app.component(ChuText.name, ChuText)
    app.component(ChuForm.name, ChuForm)
    app.component(ChuGroup.name, ChuGroup)

    const arrUnique = () => {
      return null
    }

    // 公共方法
    window.chu = {
      message: message,
      store: options.store,
      router:options.router,
      listener: mitt(),
      arrUnique
    }
  }
}

export default plugin
